


pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let base_end_index = num_str.find('(').unwrap();
    let num_value=&num_str[0..base_end_index];
    let from_base=num_str[base_end_index+1..num_str.len()-1].parse::<u32>().unwrap();

    let mut result = 0;
    let mut power=0;
    let mut num_chars = num_value.chars().rev();
    while let Some(c)=num_chars.next(){
        let  num;
        if c.is_digit(10) {
           num=c.to_digit(10).unwrap();
        } else {
          num=(c as u32) - ('a' as u32) + 10;
        }
        result+=num*from_base.pow(power);
        power+=1;
    }
    let mut ans=String::new();
    while result>0{
        let  cur;
        if result%to_base<10{
            cur= ((result%to_base) as u8 + '0' as u8) as char;
        }
        else{
            cur=((result%to_base) - 10 + ('a' as u32)) as u8 as char;
        }
        ans.push(cur);
        result/=to_base;
    }
    ans.chars().rev().collect()
}
